package com.financing.wap.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.financing.wap.dto.DstUserVisitLogDTO;
import com.financing.wap.vo.*;

import org.springframework.stereotype.Repository;

import com.financing.wap.common.SqlName;
import com.financing.wap.common.SqlName.CommonDstSql;
import com.financing.wap.dao.ICommonDstDao;
import com.financing.wap.dto.BaseDTO;
import com.financing.wap.dto.DstArticleDTO;
import com.financing.wap.dto.DstMemberInfoDTO;

/***
 *前台公用common
 *
 */
@Repository("commonDstDao")
public class CommonDstDaoImpl extends BaseDaoImpl<BaseDTO, Integer> implements ICommonDstDao {


	@Override
	public Class<BaseDTO> getEntityClass() {
		return BaseDTO.class;
	}

	@Override
	public List<DstUserInvitationVO> userInvitationList(String openid)
			throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.CommonDstSql.userInvitationList, openid);
	}

	@Override
	public int visitExecuteUpperLimit(Map<String, String> map) throws SQLException{
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.CommonDstSql.visitExecuteUpperLimit, map);
	}

	@Override
	public List<DstUserGrowthModeVO> growthMode(String openid) throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.CommonDstSql.growthMode, openid);
	}

	@Override
	public void updateMemberInfo(DstMemberInfoDTO member) throws SQLException {
		this.sqlMapClientTemplate.update(SqlName.CommonDstSql.updateMemberInfo,member);
	}

	@Override
	public int shareArticleExecuteUpperLimit(Map<String, String> map) {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.CommonDstSql.shareArticleExecuteUpperLimit, map);
	}

	@Override
	public List<DstUserTagListVO> queryTagByUser(DstUserTagListVO vo) {
		return  this.sqlMapClientTemplate.queryForList(CommonDstSql.queryTagByUser,vo);
	}

	@Override
	public List<ArticleInfoVO> topSearch(ArticleInfoVO vo) throws SQLException {
		return this.sqlMapClientTemplate.queryForList(CommonDstSql.topSearch,vo);
	}

	@Override
	public Map<String, Object> visitCountByClientOpenid(DstUserTagListVO vo)
			throws SQLException {
		return (Map<String, Object>) this.sqlMapClientTemplate.queryForObject(CommonDstSql.visitCountByClientOpenid, vo);
	}

	@Override
	public List<ArticleInfoVO> queryArticleForUser(DstArticleDTO dto)
			throws SQLException {
		return  this.sqlMapClientTemplate.queryForList(CommonDstSql.queryArticleForUser,dto);
	}

	@Override
	public List<DstUserVisitVO> dstUserVisitList(DstUserVisitVO dstUserVisitVO) throws SQLException {
		return  this.sqlMapClientTemplate.queryForList(CommonDstSql.dstUserVisitList,dstUserVisitVO);
	}

	@Override
	public List<DstUserVisitLogVO> customerUserVisitLog(DstUserVisitLogDTO dstUserVisitLog) {
		return  this.sqlMapClientTemplate.queryForList(CommonDstSql.customerUserVisitLog,dstUserVisitLog);
	}

	@Override
	public List<CacheUserInfoVO> cacheUserInfo(Map cacheObject) {
		return this.sqlMapClientTemplate.queryForList(CommonDstSql.cacheUserInfo,cacheObject);
	}

}
